# 把函数当作参数，传入另一个函数
# 需求：任意两个数字，按照指定要求整理数字后在进行求和
def sum_num(a, b, f):
    return f(a) + f(b)


print(sum_num(1, 2, abs))
print(sum_num(1.1, 2.6, round))

list1 = [1, 2, 3, 4, 5]


def func(x):
    return x ** 2


result = map(func, list1)
result1 = map(lambda x: x ** 3, list1)
print(result)
print(list(result))
print(result1)
print(list(result1))
